package Demo03;

//有返回值一个参数
@FunctionalInterface
interface OneParameterReturn {
    int test(int a);
}

//有返回值多参数
@FunctionalInterface
interface MoreParameterReturn {
    int test(int a, int b);
}

//无返回值无参数
@FunctionalInterface
interface NoParameterNoReturn {
    void test();
}

//无返回值一个参数
@FunctionalInterface
interface OneParameterNoReturn {
    void test(int a);
}

//无返回值多个参数
@FunctionalInterface
interface MoreParameterNoReturn {
    void test(int a, int b);
}

//有返回值无参数
@FunctionalInterface
interface NoParameterReturn {
    int test();
}
public class Test {
    public static void main(String[] args) {
        NoParameterReturn noParameterReturn = ()->{return 10;};
//        NoParameterReturn noParameterReturn = ()->10;
        System.out.println(noParameterReturn.test());
    }
    public static void main04(String[] args) {
        MoreParameterNoReturn moreParameterNoReturn = (a,b)-> System.out.println(a+b);
        moreParameterNoReturn.test(1,2);
    }
    public static void main03(String[] args) {
        OneParameterNoReturn oneParameterNoReturn = a-> System.out.println("重写无返回值有一个参数方法,参数a为: "+a);
        oneParameterNoReturn.test(1);
    }
    public static void main02(String[] args) {
        NoParameterNoReturn noParameterNoReturn = ()->System.out.println("重写无返回值无参数方法");
        noParameterNoReturn.test();
    }
    public static void main01(String[] args) {
        NoParameterNoReturn noParameterNoReturn = new NoParameterNoReturn() {
            @Override
            public void test() {
                System.out.println("重写无返回值无参数方法");
            }
        };
        noParameterNoReturn.test();
    }
}
